<?php

/**
 * @package Core
 */
class Core_Timer {
    protected static $timer = array();

    private function __construct() {
    }

    public static function timer($name = 'default') {
        if (empty(self::$timer[$name])) {
            self::$timer[$name] = microtime(true);
        } else {
            return (microtime(true) - self::$timer[$name]);
        }
    }

    public static function resetTimer($name = 'default') {
        self::$timer[$name] = microtime(true);
    }


}